package com.ml.mall.model;

import lombok.Data;

import java.util.Set;

/**
 * @description 邮件发送相关信息，包含发/收件人、标题、正文模板
 * @author pl
 * @date 2021/7/13
 * @version 1.0
*/
@Data
public class MailMessage {

    /**
     * 邮件标题
     */
    private String subject;

    /**
     * 邮件正文内容
     */
    private String content;

    /**
     * 收件人邮箱
     */
    private String receiverEmail;

    /**
     * 收件人邮箱
     */
    private Set<String> receiverEmailSet;

    //type:0 info 1：order
    private Integer informType = 0; //默认是0

    /**
     * 内容变量替换
     * @param target
     * @param replacement
     */
    public void contentReplace(CharSequence target, CharSequence replacement){
        this.content = this.content.replace(target, replacement);
    }

    /**
     * 标题变量替换
     * @param target
     * @param replacement
     */
    public void subjectReplace(CharSequence target, CharSequence replacement){
        this.subject = this.subject.replace(target, replacement);
    }
}
